import { createRequestTypes } from '@UTILS/reduxHelper'

export const GET_DECISION_FLOWS = createRequestTypes('GET_DECISION_FLOWS')
export const GET_SURVEY_TEMPLATES = createRequestTypes('GET_SURVEY_TEMPLATES')
export const START_JOUNEY = createRequestTypes('START_JOUNEY')
export const START_SURVEY = createRequestTypes('START_SURVEY')
export const MAKE_CHOICE = createRequestTypes('MAKE_CHOICE')
export const MOVE_TO_STEP = createRequestTypes('MOVE_TO_STEP')
export const CLEAR_FLOW_NODES = createRequestTypes('CLEAR_FLOW_NODES')
export const MOVE_TO_SURVEY_STEP = createRequestTypes('MOVE_TO_SURVEY_STEP')
export const SUBMIT_SURVEY = createRequestTypes('SUBMIT_SURVEY')
export const GET_DECISION_RESULT = createRequestTypes('GET_DECISION_RESULT')
export const GET_LAST_DECISION = createRequestTypes('GET_LAST_DECISION')
export const SYNC_NUMBER = createRequestTypes('SYNC_NUMBER')
export const CLEAR_RESULT_ERROR = createRequestTypes('CLEAR_RESULT_ERROR')
export const GET_FLOWS_NUMBER = createRequestTypes('GET_FLOWS_NUMBER')
export const GET_DECISION_DETAIL = createRequestTypes('GET_DECISION_DETAIL')
export const GET_RESULT_DOCTORS = createRequestTypes('GET_RESULT_DOCTORS')
export const GET_RESULT_FEEDITEMS = createRequestTypes('GET_RESULT_FEEDITEMS')
export const GET_RESULT_GOODS = createRequestTypes('GET_RESULT_GOODS')
export const GET_TEMPLATES_BY_TAG_IDS = createRequestTypes('GET_TEMPLATES_BY_TAG_IDS')

export default {
  dispatchGetDecisionFlows(isInitial) {
    return {
      type: GET_DECISION_FLOWS.REQUEST,
      isInitial,
    }
  },
  dispatchStartJouney(id, plan) {
    return {
      type: START_JOUNEY.REQUEST,
      id,
      plan
    }
  },
  dispatchMakeChoice(payload, data, plan) {
    return {
      type: MAKE_CHOICE.REQUEST,
      payload,
      data,
      plan
    }
  },
  dispatchMoveToStep(payload, data, plan) {
    return {
      type: MOVE_TO_STEP.REQUEST,
      payload,
      data,
      plan
    }
  },
  dispatchClearFlowNodes() {
    return {
      type: CLEAR_FLOW_NODES.REQUEST,
    }
  },
  dispatchGetSurveyTemplates(isInitial) {
    return {
      type: GET_SURVEY_TEMPLATES.REQUEST,
      isInitial,
    }
  },
  dispatchStartSurvey(id, journeyId, dId) {
    return {
      type: START_SURVEY.REQUEST,
      id,
      journeyId,
      doctorId: dId
    }
  },
  dispatchMoveToSurveyStep(payload) {
    return {
      type: MOVE_TO_SURVEY_STEP.REQUEST,
      payload
    }
  },
  dispatchSubmitSurvey(questionCode, data, isFromServicepack) {
    return {
      type: SUBMIT_SURVEY.REQUEST,
      questionCode,
      data,
      isFromServicepack
    }
  },
  dispatchGetDecisionResult(id, isSurvey) {
    return {
      type: GET_DECISION_RESULT.REQUEST,
      id,
      isSurvey,
    }
  },
  dispatchGetLastSurvey(id, isSurvey) {
    return {
      type: GET_LAST_DECISION.REQUEST,
      id,
      isSurvey,
    }
  },
  dispatchClearResultError() {
    return {
      type: CLEAR_RESULT_ERROR.REQUEST,
    }
  },
  dispatchGetMyDistinctFlowsNumber() {
    return {
      type: GET_FLOWS_NUMBER.REQUEST,
    }
  },
  dispatchGetDecisionDetail(id, isSurvey) {
    return {
      type: GET_DECISION_DETAIL.REQUEST,
      id,
      isSurvey
    }
  },
  dispatchGetResultDoctors(tIds) {
    return {
      type: GET_RESULT_DOCTORS.REQUEST,
      tIds
    }
  },
  dispatchGetResultFeedItems(tIds) {
    return {
      type: GET_RESULT_FEEDITEMS.REQUEST,
      tIds
    }
  },
  dispatchGetTemplatesByTagIds(tIds) {
    return {
      type: GET_TEMPLATES_BY_TAG_IDS.REQUEST,
      tIds
    }
  }
}
